<template>
	<div 
		v-empty="list.length <= 0"
		class="rc-cont" 
		style="padding-right:50px;min-height:500px;">
		<flexbox 
			v-for="(item, index) in list" 
			:key="index" 
			class="ha-cont" 
			align="stretch" 
			justify="flex-start">
			<div class="ha-week">{{ item.create_time|filterTimestampToFormatTime('YYYY-MM-DD dddd') }}</div>
			<div class="ha-circle" />
			<div class="ha-time">{{ item.create_time|filterTimestampToFormatTime('H:mm') }}</div>
			<div 
				v-photo="item.create_user_id"
				v-lazy:background-image="$options.filters.filterUserLazyImg(item.create_user_id)"
				class="div-photo ha-img" />
			<div class="ha-name">{{ item.create_user_id[0].username }}</div>
			<div class="ha-content">
				<p>{{ item.content }}</p>
			</div>
			<div class="ha-line" />
		</flexbox>
	</div>
</template>

<script type="text/javascript">
	import { crmActionRecord } from '@/api/customer/customer'
	import { crmLawcaseActionRecord } from '@/api/lawcase/lawcase'
	import { crmContractActionRecord } from '@/api/contract/contract'
	export default {
		name: 'ActionRecord', // 相关操作
		components: {},
		props: {
			/** 模块ID */
			id: [String, Number],
			crmType: {
				type: String,
				default: ''
			}
		},
		data() {
			return {
				list:[]
			}
		},
		computed: {},
		watch: {
			id: function(val) {
				this.getList()
			}
		},
		mounted() {
			this.getList()
		},
		activated: function() {},
		deactivated: function() {},
		methods: {
			getList(){
				let request
				if(this.crmType == 'customer'){
					request = crmActionRecord
				}else if(this.crmType == 'lawcase'){
					request = crmLawcaseActionRecord
				}else if(this.crmType == 'contract'){
					request = crmContractActionRecord
				}
				request({
						customer_id: this.id
					})
					.then(res => {
						this.list = res.data
					})
					.catch(() => {})
			}
		}
	}
</script>
<style lang="scss" scoped>
	/**客户下相关信息 table 效果 */
	.rc-cont {
		position: relative;
		padding: 20px 20px 20px 0;

		.rc-head {
			margin-bottom: 15px;
			position: relative;

			.rc-head-item {
				font-size: 15px;
				padding: 8px 5px;
				border-radius: 2px;
				margin-right: 20px;
				margin-left: 0px;
			}

			.rc-head-item:first-child {
				margin-right: 0;
			}
		}
	}

	.el-table /deep/ thead th {
		background-color: #F5F5F5;
		font-weight: 400;
		font-size: 12px;
	}

	.el-table /deep/ tbody {
		font-size: 13px;
	}

	.ha-cont {
		font-size: 14px;
		position: relative;
		line-height: 20px;
		min-height: 40px;
		padding-top: 3px;

		.ha-week {
			margin: 0 17px 0 20px;
			flex-shrink: 0;
			color: #777;
			width: 150px;
		}

		.ha-time {
			padding: 0 20px 0 45px;
			flex-shrink: 0;
			color: #aaa;
		}

		.ha-circle {
			flex-shrink: 0;
			width: 18px;
			height: 18px;
			border-radius: 9px;
			background-color: white;
			border: 5px solid #a5ecd7;
			z-index: 2;
		}

		.ha-img {
			flex-shrink: 0;
			margin: -3px 10px 0 10px;
			display: block;
			width: 30px;
			height: 30px;
			border-radius: 15px;
		}

		.ha-name {
			padding: 0 10px;
			flex-shrink: 0;
			color: #333;
		}

		.ha-content {
			padding: 0px 10px 10px 10px;
			flex: 1;
			color: #333;
		}

		.ha-line {
			position: absolute;
			z-index: 1;
			width: 1px;
			top: 3px;
			bottom: -3px;
			left: 195px;
			background-color: #e6e6e6;
		}
	}
</style>
